﻿using ArchivingDataModel;
using ArchivingDataWebForms.Helpers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ArchivingDataWebForms.Pages.Login
{
    public partial class WebFormLogin : WebFormBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login_LoggedIn(object sender, EventArgs e)
        {
            try
            {
                using (ArchivingDataEntities ent = new ArchivingDataEntities())
                {
                    string userID=Membership.GetUser(this.Login.UserName).ProviderUserKey.ToString();
                    var employee=ent.Employees.Include("Organization").FirstOrDefault(i => i.User_ID == userID);
                    this.Session["LabelLoginName"] = employee.Organization.Organization_Name_AR + " : " + employee.Employee_NameAR; 
                }
            }
            catch (Exception er)
            {
                this.ShowNotification("حدث الخطا التالي " + er.Message, NotificationIconType.Error);
                return;
            }

        }

    }
}